<html>
<head><meta charset="utf-8"><title>Why is Rust not rustfmt-clean? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html">Why is Rust not rustfmt-clean?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216630199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630199">(Nov 13 2020 at 15:53)</a>:</h4>
<p>I submitted a (tiny) PR, and it's been rejected several times because sections of it don't match <code>rustfmt</code>. That's fine, I want everything to match rustfmt, but in this case it was existing code that I had moved from one file to a different one.</p>
<p>So I ran <code>cargo fmt</code> over the Rust tree, and it changed a huge number of things. Why is the Rust tree not fmt-clean?</p>
<p>Also, is there a way to run the same check that the GitHub bot will run, but run it locally before I submit my PR? I don't like submitting a PR that wastes people's time and machine resources, especially over whitespace formatting. But I want to emphasize -- I 100% agree with the reason to have a canonical format, I'm just asking for some help with our PR process relating to it.</p>



<a name="216630219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630219">(Nov 13 2020 at 15:53)</a>:</h4>
<p>You should use x.py fmt</p>



<a name="216630303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630303">(Nov 13 2020 at 15:54)</a>:</h4>
<p>Ahh, so that's the secret sauce. Does that format only edited regions?</p>



<a name="216630307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630307">(Nov 13 2020 at 15:54)</a>:</h4>
<p>cargo fmt is probably either formatting things not currently canonicalized (e.g., submodules? or clippy)</p>



<a name="216630339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630339">(Nov 13 2020 at 15:54)</a>:</h4>
<p>or just not picking up rustfmt.toml for some reason</p>



<a name="216630362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630362">(Nov 13 2020 at 15:54)</a>:</h4>
<p>No, it'll reformat the whole repository</p>



<a name="216630377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630377">(Nov 13 2020 at 15:54)</a>:</h4>
<p>well, everything needed</p>



<a name="216630398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630398">(Nov 13 2020 at 15:54)</a>:</h4>
<p>It's what is run on CI</p>



<a name="216630430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630430">(Nov 13 2020 at 15:54)</a>:</h4>
<p>You can use the underlying rustfmt binary to format specific files</p>



<a name="216630433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630433">(Nov 13 2020 at 15:54)</a>:</h4>
<p><code>cargo fmt</code> will likely either use stable or nightly rustfmt (depending on which version you set as global default), but <code>./x.py fmt</code> uses the version matching the beta compiler.</p>



<a name="216630476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630476">(Nov 13 2020 at 15:55)</a>:</h4>
<p>Ok, sounds good.</p>



<a name="216630551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630551">(Nov 13 2020 at 15:55)</a>:</h4>
<p>I wonder if there's a way to have cargo say something if you don't go through x.py</p>



<a name="216630557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630557">(Nov 13 2020 at 15:55)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> actually, no, x.py fmt uses a pinned nightly -- we need unstable features, can't do that with beta rustfmt</p>



<a name="216630591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630591">(Nov 13 2020 at 15:55)</a>:</h4>
<p>I had an idea for <code>check/build</code> but I don't think <code>fmt</code> runs build scripts</p>



<a name="216630787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630787">(Nov 13 2020 at 15:57)</a>:</h4>
<p>I'm in the habit of running formatting directly in VS Code all the time, so it was strange to me that it formatted differently than that the GH bot wanted.</p>



<a name="216630802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630802">(Nov 13 2020 at 15:57)</a>:</h4>
<p>Yeah, I doubt we could make it happen without a cargo change, though I think that's not out of the picture</p>



<a name="216630894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630894">(Nov 13 2020 at 15:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="255061">Léo Lanteri Thauvin</span> <a href="#narrow/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F/near/216630430">said</a>:</p>
<blockquote>
<p>You can use the underlying rustfmt binary to format specific files</p>
</blockquote>
<p>(It's located in <code>build/&lt;your-target-triple&gt;/stage0/bin/rustfmt</code>)</p>



<a name="216630899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630899">(Nov 13 2020 at 15:57)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> fwiw, I use vim, but it should be relatively easy I imagine to switch vs code to use the correct rustfmt for rust-lang/rust (it should be roughly in build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt,</p>



<a name="216630937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216630937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216630937">(Nov 13 2020 at 15:58)</a>:</h4>
<p>honestly the better solution is to use <code>rust-toolchain</code> <a href="https://github.com/rust-lang/rust/issues/76419">https://github.com/rust-lang/rust/issues/76419</a></p>



<a name="216631003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631003">(Nov 13 2020 at 15:58)</a>:</h4>
<p>I need to get around to adding that</p>



<a name="216631156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631156">(Nov 13 2020 at 15:59)</a>:</h4>
<p>er, but there's different toolchains for rustfmt and like, everything else</p>



<a name="216631189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631189">(Nov 13 2020 at 15:59)</a>:</h4>
<p>right: <a href="https://github.com/rust-lang/rust/issues/76419#issuecomment-700817055">https://github.com/rust-lang/rust/issues/76419#issuecomment-700817055</a></p>



<a name="216631257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631257">(Nov 13 2020 at 16:00)</a>:</h4>
<p>oh though actually, that might be a way to force cargo to not work</p>



<a name="216631312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631312">(Nov 13 2020 at 16:00)</a>:</h4>
<p>could we put a rust-toolchain file that said "x-py-is-the-thing-you-want"?</p>



<a name="216631325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631325">(Nov 13 2020 at 16:00)</a>:</h4>
<p>ooh I really like that</p>



<a name="216631333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631333">(Nov 13 2020 at 16:00)</a>:</h4>
<p>one sec let me try</p>



<a name="216631381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631381">(Nov 13 2020 at 16:00)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ cargo check
error: invalid channel name &#39;use-x.py-instead&#39; in &#39;/home/joshua/rustc/rust-toolchain&#39;
error: caused by: invalid toolchain name: &#39;use-x.py-instead&#39;
</code></pre></div>



<a name="216631391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631391">(Nov 13 2020 at 16:00)</a>:</h4>
<p>I love it</p>



<a name="216631444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631444">(Nov 13 2020 at 16:01)</a>:</h4>
<p>hm it did not work for me on a cargo fmt attempt</p>



<a name="216631501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631501">(Nov 13 2020 at 16:01)</a>:</h4>
<p>it works for me - do you not have rust installed through rustup maybe?</p>



<a name="216631519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631519">(Nov 13 2020 at 16:01)</a>:</h4>
<p>I do...</p>



<a name="216631582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631582">(Nov 13 2020 at 16:02)</a>:</h4>
<p>hm, maybe I have an override set?</p>



<a name="216631694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216631694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216631694">(Nov 13 2020 at 16:02)</a>:</h4>
<p>aha, yep, that was it</p>



<a name="216632092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216632092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216632092">(Nov 13 2020 at 16:05)</a>:</h4>
<p>lol, this makes bootstrap very confused though</p>
<div class="codehilite"><pre><span></span><code>$ xpy check
Updating only changed submodules
Submodules updated in 0.01 seconds
error: invalid channel name &#39;use-x.py-instead&#39; in &#39;/home/joshua/rustc/rust-toolchain&#39;
error: caused by: invalid toolchain name: &#39;use-x.py-instead&#39;
error: invalid channel name &#39;use-x.py-instead&#39; in &#39;/home/joshua/rustc/rust-toolchain&#39;
error: caused by: invalid toolchain name: &#39;use-x.py-instead&#39;
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Checking std artifacts (x86_64-unknown-linux-gnu -&gt; x86_64-unknown-linux-gnu)
</code></pre></div>



<a name="216632133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216632133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216632133">(Nov 13 2020 at 16:05)</a>:</h4>
<p>I think this is because I added <code>rustc --version</code> checking to determine teh host platform?</p>



<a name="216632140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216632140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216632140">(Nov 13 2020 at 16:05)</a>:</h4>
<p>I could run that in <code>/</code> instead</p>



<a name="216632839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216632839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216632839">(Nov 13 2020 at 16:09)</a>:</h4>
<p>Perhaps, yeah</p>



<a name="216633339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216633339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216633339">(Nov 13 2020 at 16:11)</a>:</h4>
<p>yup, this fixed it:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py</span>
<span class="gh">index 54d0a23dec5..56a6660fe93 100644</span>
<span class="gd">--- a/src/bootstrap/bootstrap.py</span>
<span class="gi">+++ b/src/bootstrap/bootstrap.py</span>
<span class="gu">@@ -193,7 +193,10 @@ def default_build_triple(verbose):</span>
     # install, use their preference. This fixes most issues with Windows builds
     # being detected as GNU instead of MSVC.
     try:
<span class="gd">-        version = subprocess.check_output(["rustc", "--version", "--verbose"])</span>
<span class="gi">+        # https://stackoverflow.com/questions/48333999</span>
<span class="gi">+        fs_root = os.path.abspath('.').split(os.path.sep)[0]+os.path.sep</span>
<span class="gi">+        version = subprocess.check_output(["rustc", "--version", "--verbose"],</span>
<span class="gi">+                cwd=fs_root)</span>
         host = next(x for x in version.split('\n') if x.startswith("host: "))
         triple = host.split("host: ")[1]
         if verbose:
</code></pre></div>



<a name="216633349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216633349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216633349">(Nov 13 2020 at 16:11)</a>:</h4>
<p>making a PR with that now</p>



<a name="216635244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Why%20is%20Rust%20not%20rustfmt-clean%3F/near/216635244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Why.20is.20Rust.20not.20rustfmt-clean.3F.html#216635244">(Nov 13 2020 at 16:25)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/79021">https://github.com/rust-lang/rust/pull/79021</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>